<?php
require_once 'pojos/Cookie.php';
require_once 'pojos/CookieType.php';
require_once 'model/CookieDao.php';
require_once 'model/CookieTypeDao.php';

$type = 0;

if (isset($_GET['cookieType'])) {
    $type = $_GET['cookieType'];
}

$cookieDao = new CookieDao();

$cookies = $cookieDao->findCookieAsCookieType($type);

?>
<table width="100%">
    <?php 
        foreach ($cookies as $cookie) {
    ?>
    <tr>
        <td width="100%" style="background: bisque">
            <table width="100%">
                <tr>
                    <td width="25%">
                        <img src="<?php echo $cookie->getImage();?>" alt="<?php $cookie->getName() ?>" width="100px" height="100px"/>
                    </td>
                    <td width="75%">
                        <ul>
                        <?php 
                            echo '<li>Tên bánh: ' . $cookie->getName() . '</li>';
                            echo '<li>Giá bán: ' . $cookie->getPrice() . '</li>';
                            echo '<li>Thông tin thêm: ' . $cookie->getDescription() . '</li>';
                        ?>
                        </ul>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <?php } ?>
</table>